<?php
namespace app\base;

class NetResult{
    public $data = null;
    public $code = 200;
    public $message = "请求成功";

    public static function getOk($data = null,$code=200,$message = "请求成功"){
        $bean = new NetResult();
        $bean->data = $data;
        $bean->code = $code;
        $bean->message = $message;
        return $bean;
    }

    public static function getFail($code=400,$message = "请求失败"){
        $bean = new NetResult();
        $bean->code = $code;
        $bean->message = $message;
        return $bean;
    }
}